respectively; if no suffix is specified, the parameter defaults to
kilobytes. In previous versions of Xen, suffixes were not supported
and the value is always interpreted as kilobytes.
+\item [ dom0\_vcpus\_pin ] Pins domain 0 VCPUs on their respective
+ physical CPUS (default=false).
\item [ tbuf\_size=xxx ] Set the size of the per-cpu trace buffers, in
pages (default 0).
\item [ sched=xxx ] Select the CPU scheduler Xen should use. The
static unsigned int dom0_max_vcpus = 1;
integer_param("dom0_max_vcpus", dom0_max_vcpus);
-extern int opt_dom0_vcpus_pin;
extern unsigned long running_on_sim;
extern char dom0_command_line[];
dom0_max_vcpus = MAX_VIRT_CPUS;
printf ("Dom0 max_vcpus=%d\n", dom0_max_vcpus);
- for ( i = 1; i < dom0_max_vcpus; i++ ) {
+ for ( i = 1; i < dom0_max_vcpus; i++ )
if (alloc_vcpu(d, i, i) == NULL)
printf ("Cannot allocate dom0 vcpu %d\n", i);
- else if (opt_dom0_vcpus_pin)
- d->vcpu[i]->cpu_affinity = cpumask_of_cpu(i);
- }
/* Copy the OS image. */
loaddomainelfimage(d,image_start);
extern void init_IRQ(void);
extern void trap_init(void);
-/* opt_dom0_vcpus_pin: If true, dom0 VCPUs are pinned. */
-unsigned int opt_dom0_vcpus_pin = 0;
-boolean_param("dom0_vcpus_pin", opt_dom0_vcpus_pin);
-
/* opt_nosmp: If true, secondary processors are ignored. */
static int opt_nosmp = 0;
boolean_param("nosmp", opt_nosmp);
0) != 0)
panic("Could not set up DOM0 guest OS\n");
- /* PIN domain0 VCPU 0 on CPU 0. */
- if (opt_dom0_vcpus_pin)
- dom0->vcpu[0]->cpu_affinity = cpumask_of_cpu(0);
-
if (!running_on_sim) // slow on ski and pages are pre-initialized to zero
scrub_heap_pages();
v->domain = d;
v->vcpu_id = vcpu_id;
- v->processor = cpu_id;
v->vcpu_info = &d->shared_info->vcpu_info[vcpu_id];
spin_lock_init(&v->pause_lock);
- v->cpu_affinity = is_idle_domain(d) ?
- cpumask_of_cpu(cpu_id) : CPU_MASK_ALL;
-
v->runstate.state = is_idle_vcpu(v) ? RUNSTATE_running : RUNSTATE_offline;
v->runstate.state_entry_time = NOW();
if ( (vcpu_id != 0) && !is_idle_domain(d) )
set_bit(_VCPUF_down, &v->vcpu_flags);
- if ( sched_init_vcpu(v) < 0 )
+ if ( sched_init_vcpu(v, cpu_id) < 0 )
{
free_vcpu_struct(v);
return NULL;
static char opt_sched[10] = "credit";
string_param("sched", opt_sched);
+/* opt_dom0_vcpus_pin: If true, dom0 VCPUs are pinned. */
+static unsigned int opt_dom0_vcpus_pin;
+boolean_param("dom0_vcpus_pin", opt_dom0_vcpus_pin);
+
+
#define TIME_SLOP (s32)MICROSECS(50) /* allow time to slip a bit */
/* Various timer handlers. */
}
}
-int sched_init_vcpu(struct vcpu *v)
+int sched_init_vcpu(struct vcpu *v, unsigned int processor)
{
- /* Initialise the per-domain timers. */
- init_timer(&v->timer, vcpu_timer_fn, v, v->processor);
- init_timer(&v->poll_timer, poll_timer_fn, v, v->processor);
+ const struct domain * const d = v->domain;
+
+ /* Initialize processor and affinity settings. */
+ v->processor = processor;
+
+ if ( is_idle_domain(d) || (d->domain_id == 0 && opt_dom0_vcpus_pin) )
+ {
+ /*
+ * The idler and potentially dom0 VCPUs are pinned onto their
+ * respective physical CPUs.
+ */
+ v->cpu_affinity = cpumask_of_cpu(processor);
- if ( is_idle_vcpu(v) )
+ /* The idle VCPUs takes over their CPUs on creation... */
+ if ( is_idle_domain(d) )
+ {
+ per_cpu(schedule_data, v->processor).curr = v;
+ per_cpu(schedule_data, v->processor).idle = v;
+ set_bit(_VCPUF_running, &v->vcpu_flags);
+ }
+ }
+ else
{
- per_cpu(schedule_data, v->processor).curr = v;
- per_cpu(schedule_data, v->processor).idle = v;
- set_bit(_VCPUF_running, &v->vcpu_flags);
+ v->cpu_affinity = CPU_MASK_ALL;
}
+ /* Initialise the per-domain timers. */
+ init_timer(&v->timer, vcpu_timer_fn, v, v->processor);
+ init_timer(&v->poll_timer, poll_timer_fn, v, v->processor);
+
TRACE_2D(TRC_SCHED_DOM_ADD, v->domain->domain_id, v->vcpu_id);
return SCHED_OP(init_vcpu, v);
cpumask_t online_affinity;
unsigned long flags;
+ if ( v->domain->domain_id == 0 && opt_dom0_vcpus_pin )
+ return -EINVAL;
+
cpus_and(online_affinity, *affinity, cpu_online_map);
if ( cpus_empty(online_affinity) )
return -EINVAL;
#define set_current_state(_s) do { current->state = (_s); } while (0)
void scheduler_init(void);
void schedulers_start(void);
-int sched_init_vcpu(struct vcpu *);
+int sched_init_vcpu(struct vcpu *v, unsigned int processor);
void sched_destroy_domain(struct domain *);
long sched_adjust(struct domain *, struct xen_domctl_scheduler_op *);
int sched_id(void);